<template>
  <div class="reportFormPage">
    <div id="domid" class="report-dom">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">砂浆拌合物试验检测记录表</div>
        <div class="codeText">BGLQ05002F</div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>记录编号：</span>
          <span class="placeholder">{{ form.jilbh }}</span>
        </div>
      </div>
      <!-- .........................1111111111111111111111111111111......................................................... -->
      <div class="table-border">
        <table height="220px" class="top-table">
          <tbody>
            <tr>
              <td align="center" width="15%" height="25">
                <span style="width: 90px; display: inline-block">工程名称</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcmc }}</span>
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程部位/用途</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="25" align="center">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>
                <span>；样品数量：</span>
                <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
                <span>；来样时间：</span>
                <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>
              </td>
            </tr>
            <tr>
              <td height="25" align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验日期</span>
              </td>
               <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>

              <td align="center" style="width: 15%">
                <span style="width: 90px; display: inline-block">试验条件</span>
              </td>
              <td v-if="isPdf" width="35%">
                温度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjwd }}</span>
                ℃；湿度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjsd }}</span
                >%RH
              </td>
              <td v-else width="35%">
                温度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjwd" class="height100" style="width: 15%" />℃；湿度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjsd" class="height100" style="width: 15%" />%RH
              </td>
            </tr>
            <tr>
              <td height="50" align="center" width="15%">
                <span style="width: 90px; display: inline-block">检测依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark" @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">判定依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView" @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="50" align="center">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark" @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .................................22222222222222222222222222222222............................................... -->
        <table height="616px" class="middle-table">
          <tbody>
            <tr>
              <td height="30" colspan="2" align="center">砂浆种类</td>
              <td colspan="3">
                <el-input type="text" v-model="form.shajzl" @blur="passshajzlValue" @keydown.native="handleKeyDown($event, 0, 0)" :ref="'0_0'" />
              </td>
              <td align="center" height="30" colspan="2">搅拌方式</td>
              <td colspan="4">
                <el-input type="text" v-model="form.jiaobfs" @blur="passjiaobfsValue" @keydown.native="handleKeyDown($event, 0, 1)" :ref="'0_1'" />
              </td>
            </tr>
            <tr trindex="0">
              <td width="100%" colspan="11" height="30">砂浆表观密度</td>
            </tr>
            <tr trindex="1">
              <td style="width: 8%">试验次数</td>
              <td colspan="2">试样筒质量(kg)</td>
              <td colspan="2">砂浆和试样筒总质量(kg)</td>
              <td colspan="2">试样筒容积(L)</td>
              <td colspan="4">表观密度测值(kg/m³)</td>
            </tr>
            <tr trindex="2">
              <td>
                <span>1</span>
              </td>
              <td colspan="2">
                <el-input type="Number" v-model="form.detailList[0].shiytzl" @blur="computeBgmd" @keydown.native="handleKeyDown($event, 1, 0)" :ref="'1_0'" />
              </td>
              <td colspan="2">
                <el-input type="Number" v-model="form.detailList[0].shajhsytzzl" @blur="computeBgmd" @keydown.native="handleKeyDown($event, 1, 1)" :ref="'1_1'" />
              </td>
              <td colspan="2">
                <el-input type="Number" v-model="form.detailList[0].shiytrj" @blur="computeBgmd" @keydown.native="handleKeyDown($event, 1, 2)" :ref="'1_2'" />
              </td>
              <td colspan="2">{{ biaogmd1 }}</td>
              <td rowspan="2" colspan="2">{{ biaogmdpj }}</td>
            </tr>
            <tr trindex="3">
              <td>
                <span>2</span>
              </td>
              <td colspan="2">
                <el-input type="Number" v-model="form.detailList[1].shiytzl" @blur="computeBgmd" @keydown.native="handleKeyDown($event, 2, 0)" :ref="'2_0'" />
              </td>
              <td colspan="2">
                <el-input type="Number" v-model="form.detailList[1].shajhsytzzl" @blur="computeBgmd" @keydown.native="handleKeyDown($event, 2, 1)" :ref="'2_1'" />
              </td>
              <td colspan="2">
                <el-input type="Number" v-model="form.detailList[1].shiytrj" @blur="computeBgmd" @keydown.native="handleKeyDown($event, 2, 2)" :ref="'2_2'" />
              </td>
              <td colspan="2">{{ biaogmd2 }}</td>
            </tr>
            <tr trindex="4">
              <td width="100%" colspan="11" height="30">砂浆稠度</td>
            </tr>
            <tr trindex="5">
              <td>试验次数</td>
              <td colspan="2">插捣次数(次)</td>
              <td colspan="1">秒表初始读数(s)</td>
              <td colspan="1">秒表终止读数(s)</td>
              <td colspan="6">下沉深度(mm)</td>
            </tr>
            <tr trindex="6">
              <td>
                <span>1</span>
              </td>
              <td colspan="2">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[0].chadcs" @keydown.native="handleKeyDown($event, 3, 0)" :ref="'3_0'" />
              </td>
              <td colspan="1">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[0].miaobds" @keydown.native="handleKeyDown($event, 3, 1)" :ref="'3_1'" />
              </td>
              <td colspan="1">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[0].miaobds2" @keydown.native="handleKeyDown($event, 3, 2)" :ref="'3_2'" />
              </td>

              <td colspan="3">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[0].xiacsd" @blur="computeChoud" @keydown.native="handleKeyDown($event, 3, 3)" :ref="'3_3'" />
              </td>
              <td rowspan="2" colspan="3">{{ xiacsdpj }}</td>
            </tr>

            <tr trindex="7">
              <td>
                <span>2</span>
              </td>
              <td colspan="2">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[1].chadcs" @keydown.native="handleKeyDown($event, 4, 0)" :ref="'4_0'" />
              </td>
              <td colspan="1">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[1].miaobds" @keydown.native="handleKeyDown($event, 4, 1)" :ref="'4_1'" />
              </td>
              <td colspan="1">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[1].miaobds2" @keydown.native="handleKeyDown($event, 4, 2)" :ref="'4_2'" />
              </td>
              <td colspan="3">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[1].xiacsd" @blur="computeChoud" @keydown.native="handleKeyDown($event, 4, 3)" :ref="'4_3'" />
              </td>
            </tr>

            <tr trindex="8">
              <td width="100%" colspan="11" height="30">砂浆分层度</td>
            </tr>
            <tr trindex="9">
              <td>试验次数</td>
              <td colspan="2">未装入分层筒前稠度(mm)</td>
              <td colspan="2">分层后测得的砂浆稠度值(mm)</td>
              <td colspan="3">分层度测值(mm)</td>
              <td colspan="3">分层度测定值(mm)</td>
            </tr>
            <tr trindex="10">
              <td>
                <span>1</span>
              </td>
              <td colspan="2">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[0].weizrfctqcd" @blur="computeFcd" @keydown.native="handleKeyDown($event, 5, 0)" :ref="'5_0'" />
              </td>
              <td colspan="2">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[0].fenchcdsjcd" @blur="computeFcd" @keydown.native="handleKeyDown($event, 5, 1)" :ref="'5_1'" />
              </td>
              <td colspan="3">{{ form.detailList[0].fencdcz }}</td>
              <td rowspan="2" colspan="3">{{ form.detailList[0].fencdczpj }}</td>
            </tr>

            <tr trindex="11">
              <td>
                <span>2</span>
              </td>
              <td colspan="2">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[1].weizrfctqcd" @blur="computeFcd" @keydown.native="handleKeyDown($event, 6, 0)" :ref="'6_0'" />
              </td>
              <td colspan="2">
                <el-input type="Number" style="text-align: center" v-model="form.detailList[1].fenchcdsjcd" @blur="computeFcd" @keydown.native="handleKeyDown($event, 6, 1)" :ref="'6_1'" />
              </td>
              <td colspan="3">{{ form.detailList[1].fencdcz }}</td>
            </tr>

            <tr trindex="12">
              <td width="100%" colspan="11" height="30">砂浆保水性</td>
            </tr>
            <tr trindex="13">
              <td>试验次数</td>
              <td>底部不透水片与干燥试模质量(g)</td>
              <td>15片滤纸吸水前的质量(g)</td>
              <td>试模、底部透水片与砂浆总质量(g)</td>
              <td>15片滤纸吸水后的质量(g)</td>
              <td>砂浆样本总质量(g)</td>
              <td>烘干后砂浆样本质量(g)</td>
              <td style="width: 7%">含水率(%)</td>
              <td style="width: 7%">平均含水率(%)</td>
              <td style="width: 7%">保水率测值(%)</td>
              <td style="width: 7%">保水率测定值(%)</td>
            </tr>
            <tr trindex="14">
              <td>
                <span>1</span>
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[0].dibbtspygzsmzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 7, 0)" :ref="'7_0'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[0].lvzxsqdzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 7, 1)" :ref="'7_1'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[0].shimdbtspysjzzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 7, 2)" :ref="'7_2'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[0].lvzxshdzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 7, 3)" :ref="'7_3'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[0].shajybzzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 7, 4)" :ref="'7_4'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[0].hongghsjybzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 7, 5)" :ref="'7_5'" />
              </td>
              <td>{{ form.detailList[0].hansl }}</td>
              <td rowspan="2">{{ form.detailList[0].hanslpj }}</td>
              <td>{{ form.detailList[0].baosl }}</td>
              <td rowspan="2">{{ form.detailList[0].baoslpj }}</td>
            </tr>

            <tr trindex="15">
              <td>
                <span>2</span>
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[1].dibbtspygzsmzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 8, 0)" :ref="'8_0'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[1].lvzxsqdzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 8, 1)" :ref="'8_1'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[1].shimdbtspysjzzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 8, 2)" :ref="'8_2'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[1].lvzxshdzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 8, 3)" :ref="'8_3'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[1].shajybzzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 8, 4)" :ref="'8_4'" />
              </td>
              <td>
                <el-input type="Number" v-model="form.detailList[1].hongghsjybzl" @blur="computeBsl" @keydown.native="handleKeyDown($event, 8, 5)" :ref="'8_5'" />
              </td>
              <td>{{ form.detailList[1].hansl }}</td>
              <td>{{ form.detailList[1].baosl }}</td>
            </tr>
          </tbody>
        </table>
        <!-- .....................................................33333333333333333................................................... -->
        <table height="30px" class="bottom-table">
          <tbody>
            <tr>
              <td>
                <el-input :rows="2" type="textarea" v-model="form.fujsm" @focus="handleFocus('fujsm')" />
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <!-- .................................44444444444............................................. -->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">记录：</td>
            <td width="15%" align="left"></td>
            <td width="10%" align="right">复核：</td>
            <td align="left" width="15%"></td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block; margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType" />
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument" />
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType" />
  </div>
</template>

<script>
import { handleFocus, emptyConvert, handleKeyDown } from "@/views/reportForms/utils";
import Bus from "@/utils/bus";
import decimal from "@/utils/big-decimal";
import { getSjBhwxnsyjcjlBsInfo } from "@/api/reportsj/sjBhwxnsyjcjlBsInfo";

import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";

export default {
  name: "bhw",
  components: {
    BsInstrumentView,
    BsJiancyjView,
    BsJudgeBaseView
  },
  data() {
    return {
      baoslpj: "",
      baosl: {
        baosl1: "",
        baosl2: ""
      },
      hanslpj: "",
      hansl: {
        hansl1: "",
        hansl2: ""
      },
      fencdczpj: "",
      fencd: {
        fencd1: 0,
        fencd2: 0
      },
      biaogmd1: null,
      biaogmd2: null,
      biaogmd: {
        biaogmd1: "",
        biaogmd2: ""
      },
      biaogmdpj: "",
      jilbh: "",
      xiacsdpj: null,
      form: {
        detailList: [{}, {}],
        xiacsdpj: null,
        shiyrq: "2024年03月09日",
        gongcbwyt: "",
        jilbh: "",
        jiancdwmc: "山东路桥集团试验检测中心有限公司泰安高速公路施工总承包项目工地试验室",
        totalPage: "",
        page: "",
        jiancyj: "",
        zhuyyqsbmcjbh: "",
        gongcmc: "汾阳至石楼高速公路",
        yangpmc: "K39+820-K40+440原地面",
        yangpbh: "JTG/T 3610-2019",
        laiysj: "2022年03月09日",
        yangpsl: "3kg",
        yangpzt: "完好无损"
      },
      fjsm: "附加声明：",
      dateText: "2024年05月10日",
      readonly: false
    };
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    isPdf: {
      type: Boolean,
      default: () => false
    },
    syType: {
      type: [String, Number],
      default: () => ""
    }
  },
  watch: {},
  created() {
    this.getInfo();
  },
  methods: {
    // 获取详情
    getInfo() {
      if (!this.excelId) {
        return;
      }
      getSjBhwxnsyjcjlBsInfo(this.excelId).then((response) => {
        this.form = response.data;
        console.log("detaillist---------------", this.form.detailList);
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
        this.biaogmdpj = this.form.detailList[0].biaogmdczpj;
        this.biaogmd1 = this.form.detailList[0].biaogmdcz;
        this.biaogmd2 = this.form.detailList[1].biaogmdcz;
        this.xiacsdpj = this.form.detailList[0].xiacsdpj;
      });
    },
    // 显示检测依据列表
    showBsJiancyjView() {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj(info) {
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
      Bus.$emit("setSjbhwBgJiancyj", { jiancyj: this.form.jiancyj, jiancyjIds: this.form.jiancyjIds });
    },
    // 显示判定依据列表
    showBsJudgeBaseView() {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge(info) {
       this.form.pandyjIds = info.ids;
      this.form.pandyj = info.label;
    },
    // 显示仪器列表
    showBsInstrumentView() {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 仪器选择
    selectInstrument(info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
      Bus.$emit("setSjbhwBgZhuyyqsbmcjbh", { zhuyyqsbmcjbh: this.form.zhuyyqsbmcjbh, shebIds: this.form.shebIds });
    },

    submitForm() {
      return this.form;
    },

    //传值
    passshajzlValue() {
      Bus.$emit("bhwshajzl", this.form.shajzl);
    },
    //传值
    passjiaobfsValue() {
      Bus.$emit("bhwjiaobfs", this.form.jiaobfs);
    },
    //计算稠度
    computeChoud() {
      if (this.form.detailList[0].xiacsd && this.form.detailList[1].xiacsd) {
        let jg = decimal.divide(decimal.add(parseFloat(this.form.detailList[0].xiacsd), parseFloat(this.form.detailList[1].xiacsd)), 2);
        this.xiacsdpj = decimal.round(jg, 0) || 0;
      } else {
        this.xiacsdpj = null;
      }
      this.form.detailList[0].xiacsdpj = this.xiacsdpj;
      //传值
      Bus.$emit("setSjbhwBgJiancjg", [{ key: 156, value: this.xiacsdpj }]);
    },
    //计算表观密度
    computeBgmd() {
      if (this.form.detailList[0].shajhsytzzl && this.form.detailList[0].shiytzl && this.form.detailList[0].shiytrj) {
        this.biaogmd1 = decimal.divide(
          decimal.multiply(1000, decimal.subtract(parseFloat(this.form.detailList[0].shajhsytzzl), parseFloat(this.form.detailList[0].shiytzl))),
          parseFloat(this.form.detailList[0].shiytrj),
          0
        );
      } else {
        this.biaogmd1 = null;
      }
      if (this.form.detailList[1].shajhsytzzl && this.form.detailList[1].shiytzl && this.form.detailList[1].shiytrj) {
        this.biaogmd2 = decimal.divide(
          decimal.multiply(1000, decimal.subtract(parseFloat(this.form.detailList[1].shajhsytzzl), parseFloat(this.form.detailList[1].shiytzl))),
          parseFloat(this.form.detailList[1].shiytrj),
          0
        );
      } else {
        this.biaogmd2 = null;
      }
      this.form.detailList[0].biaogmdcz = this.biaogmd1;
      this.form.detailList[1].biaogmdcz = this.biaogmd2;
      if (this.biaogmd1 && this.biaogmd2) {
        this.biaogmdpj = decimal.divide(decimal.add(this.biaogmd1, this.biaogmd2), 2, -1);
      } else {
        this.biaogmdpj = null;
      }
      this.form.detailList[0].biaogmdczpj = this.biaogmdpj;
      Bus.$emit("setSjbhwBgJiancjg", [{ key: 155, value: this.biaogmdpj }]);
    },

    //计算分层度
    computeFcd() {
      // fencdcz,fencdczpj
      if (this.form.detailList[0].weizrfctqcd && this.form.detailList[0].fenchcdsjcd) {
        this.form.detailList[0].fencdcz = decimal.subtract(parseFloat(this.form.detailList[0].weizrfctqcd), parseFloat(this.form.detailList[0].fenchcdsjcd));
      }
      if (this.form.detailList[1].weizrfctqcd && this.form.detailList[1].fenchcdsjcd) {
        this.form.detailList[1].fencdcz = decimal.subtract(parseFloat(this.form.detailList[1].weizrfctqcd), parseFloat(this.form.detailList[1].fenchcdsjcd));
      }
      if (this.form.detailList[0].fencdcz && this.form.detailList[1].fencdcz) {
        this.form.detailList[0].fencdczpj = this.form.detailList[1].fencdczpj = decimal.divide(decimal.add(this.form.detailList[0].fencdcz, this.form.detailList[1].fencdcz), 2);
      } else {
        this.form.detailList[0].fencdczpj = this.form.detailList[1].fencdczpj = null;
      }
      Bus.$emit("setSjbhwBgJiancjg", [{ key: 158, value: this.form.detailList[0].fencdczpj }]);
    },

    //计算保水率
    computeBsl() {
      if (this.form.detailList[0].shajybzzl && this.form.detailList[0].hongghsjybzl) {
        // this.hansl.hansl1 = parseFloat((100 * (this.form.detailList[0].shajybzzl - this.form.detailList[0].hongghsjybzl)) / this.form.detailList[0].shajybzzl).toFixed(1);
        let jg = decimal.divide(decimal.multiply(100, decimal.subtract(this.form.detailList[0].shajybzzl, this.form.detailList[0].hongghsjybzl)), this.form.detailList[0].shajybzzl);
        this.form.detailList[0].hansl = decimal.round(jg, 1);
      } else {
        this.form.detailList[0].hansl = null;
      }
      if (this.form.detailList[1].shajybzzl && this.form.detailList[1].hongghsjybzl) {
        let jg = decimal.divide(decimal.multiply(100, decimal.subtract(this.form.detailList[1].shajybzzl, this.form.detailList[1].hongghsjybzl)), this.form.detailList[1].shajybzzl);
        this.form.detailList[1].hansl = decimal.round(jg, 1);
      } else {
        this.form.detailList[1].hansl = null;
      }
      //含水率平均
      if (this.form.detailList[0].hansl && this.form.detailList[1].hansl) {
        let jg = (this.form.detailList[1].hanslpj = decimal.divide(decimal.add(this.form.detailList[0].hansl, this.form.detailList[1].hansl), 2));
        this.form.detailList[0].hanslpj = decimal.round(jg, 1);
      } else {
        this.form.detailList[0].hanslpj = this.form.detailList[1].hanslpj = null;
      }
      //保水率
      let a = this.form.detailList[0],
        b = this.form.detailList[1];
      if (a.dibbtspygzsmzl && a.lvzxsqdzl && a.shimdbtspysjzzl && a.lvzxshdzl && a.shajybzzl && a.hongghsjybzl && a.hanslpj) {
        // this.baosl.baosl1 = ((1 - (100 * (a.lvzxshdzl - a.lvzxsqdzl)) / (this.hanslpj * (a.shimdbtspysjzzl - a.dibbtspygzsmzl))) *100).toFixed(1);
        this.form.detailList[0].baosl = decimal.multiply(
          decimal.subtract(
            1,
            decimal.divide(decimal.multiply(100, decimal.subtract(a.lvzxshdzl, a.lvzxsqdzl), 9), decimal.multiply(a.hanslpj, decimal.subtract(a.shimdbtspysjzzl, a.dibbtspygzsmzl), 9), 9),
            9
          ),
          100,
          1
        );
      } else {
        this.form.detailList[0].baosl = null;
      }
      if (b.dibbtspygzsmzl && b.lvzxsqdzl && b.shimdbtspysjzzl && b.lvzxshdzl && b.shajybzzl && b.hongghsjybzl && b.hanslpj) {
        this.form.detailList[1].baosl = decimal.multiply(
          decimal.subtract(
            1,
            decimal.divide(decimal.multiply(100, decimal.subtract(b.lvzxshdzl, b.lvzxsqdzl), 9), decimal.multiply(b.hanslpj, decimal.subtract(b.shimdbtspysjzzl, b.dibbtspygzsmzl), 9), 9),
            9
          ),
          100,
          1
        );
      } else {
        this.form.detailList[1].baosl = null;
      }
      //保水率平均
      if (this.form.detailList[0].baosl && this.form.detailList[1].baosl) {
        this.form.detailList[0].baoslpj = this.form.detailList[1].baoslpj = decimal.divide(decimal.add(this.form.detailList[0].baosl, this.form.detailList[1].baosl), 2, 1);
      } else {
        this.form.detailList[0].baoslpj = this.form.detailList[1].baoslpj = null;
      }
      //传值；
      Bus.$emit("setSjbhwBgJiancjg", [{ key: 157, value: this.form.detailList[0].baoslpj }]);
    },

    handleFocus(event) {
      handleFocus(event, this.page, this.form[event]);
    },
    handleKeyDown(event, rowIndex, colIndex) {
      const maxArr = [1, 2, 2, 2, 2, 1, 1, 5, 5];
      const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
      if (this.$refs[ref]?.length) {
        this.$refs[ref][0].focus();
      } else if (this.$refs[ref]) {
        this.$refs[ref].focus();
      }
    }
  }
};
</script>

<style scoped lang="scss">
</style>
